********* ============================================================= ********
*** Replication Material for: ***
*** Changing the Lens: The contingency of results from conjoint experiments on 
*** the outcome variable and the estimand, Research & Politics - 
*** Reanalysis of Jensen et al. (2021) City limits to partisan polarization in 
*** the American public
*** Author: Clareta Treger, PhD

*** Updated: May 13, 2025 ***
********* ============================================================= ********

*** === Data File === ***

*The datafile used is generated based on code lines 1-137 in the replication 
*file of the original article "Conjoint analysis"

use "all_conjoint.dta"

********************************************************************************
** Clareta: creating a dataset for conjoint analysis of Strong Reps and Dems **
********************************************************************************
*cd "C:\Users\clare\Documents\PostDoc @UofT\Changing the Lens paper\Research & Politics submission\Replication material\Jenen_replication"
*use "C:\Users\clare\Documents\PostDoc @UofT\Changing the Lens paper\Research & Politics submission\Replication material\Jenen_replication\Data\msa_survey_indiv.dta"
*cd "C:\Users\clare\Documents\PostDoc @UofT\Changing the Lens paper\Research & Politics submission\Replication material\Jenen_replication\data"

count if strong_democrat==1 | strong_republican == 1
tab strong_DR, m
keep if strong_DR !=.
save "strong_rep_dem_conjoint.dta", replace

*** === Table D1 === ***

** AMCEs and MMs by strong partisanship 
* 0 = Strong Democrats; 
* 1 = Strong Republicans

forvalue i = 0/1{
reg plan_chosen ib5.educ ib5.hieduc ib4.invest ib3.gov ib5.workers ib4.local [pweight=weight] if strong_DR==`i', cluster(caseid)
margins ib5.educ ib5.hieduc ib4.invest ib3.gov ib5.workers ib4.local [pweight=weight], post 
eststo party_`i'
}

*** === Figure D1 - Marginal Means (right panel) === ***

coefplot ///
(party_0, label("Strong Democrats") msymbol(circle) mcolor(black) mfcolor(none) ciopts(lcolor(black) lwidth(thin))) ///
(party_1, label("Strong Republicans") msymbol(circle) mcolor(black) ciopts(lcolor(black) lwidth(thin))), ///
legend(cols(3) region(fcolor(white) lcolor(white)) size(medium)) ///
title(/*"Strong Democrats and Republicans"*/"") xlabel(.4(.05) 0.5) omitted base xline(0.5) ///
headings(2.educ = "{bf:Education}" 3.hieduc = "{bf:Higher Education}" 2.invest = "{bf:Investment & Taxes}" 2.gov = "{bf:Governance}" ///
3.workers = "{bf:Workers & Entrepreneurs}" 2.local = "{bf:Local Services}") ///
drop(_cons) ///
order(2.invest 3.invest 1.invest 4.invest 3.workers 4.workers 1.workers 2.workers 5.workers 2.local 3.local 1.local 4.local 2.gov 1.gov 3.gov 2.educ 4.educ 3.educ 1.educ 5.educ 3.hieduc 4.hieduc 2.hieduc 1.hieduc 5.hieduc) ///
ylabel(, labsize(medium)) xtitle("Marginal means") ytitle("") xsize(5) ysize(7) scale(.6)  


*** === Figure D1 - AMCEs (left panel) - from original Jensen et al. paper === ***

* Strong Democrats
reg plan_chosen ib5.educ ib5.hieduc ib4.invest ib3.gov ib5.workers ib4.local [pweight=weight] if strong_DR==0, cluster(caseid)
estimate store baseline_w0
local n_baseline0 = e(N)

* Strong Republicans
reg plan_chosen ib5.educ ib5.hieduc ib4.invest ib3.gov ib5.workers ib4.local [pweight=weight] if strong_DR==1, cluster(caseid)
estimate store baseline_w1
local n_baseline1 = e(N)

coefplot ///
(baseline_w0, label("Strong Democrats") msymbol(circle) mcolor(black) mfcolor(none) ciopts(lcolor(black) lwidth(thin))) ///
(baseline_w1, label("Strong Republicans") msymbol(circle) mcolor(black) ciopts(lcolor(black) lwidth(thin))), ///
legend(cols(3) region(fcolor(white) lcolor(white)) size(medium)) ///
title(/*"Strong Democrats and Republicans"*/"") xlabel(-0.15(.05) 0.15) omitted base xline(0) ///
headings(2.educ = "{bf:Education}" 3.hieduc = "{bf:Higher Education}" 2.invest = "{bf:Investment & Taxes}" 2.gov = "{bf:Governance}" ///
3.workers = "{bf:Workers & Entrepreneurs}" 2.local = "{bf:Local Services}") ///
drop(_cons) ///
order(2.invest 3.invest 1.invest 4.invest 3.workers 4.workers 1.workers 2.workers 5.workers 2.local 3.local 1.local 4.local 2.gov 1.gov 3.gov 2.educ 4.educ 3.educ 1.educ 5.educ 3.hieduc 4.hieduc 2.hieduc 1.hieduc 5.hieduc) ///
ylabel(, labsize(medium)) xtitle("Change in Pr(Development Plan Selected)") ytitle("") xsize(5) ysize(7) scale(.6)  

